package cate.common.table.text;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.util.random.RWItem;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "系统公告")
public class TextLampRow extends ERow implements RWItem {

    @NoteField(value = "发送系统频道")
    public boolean sendSystemChannel;

    @NoteField(value = "发送协会频道")
    public boolean sendGuildChannel;

    @NoteField(value = "发送世界频道")
    public boolean sendWorldChannel;

    @NoteField(value = "发送跨服频道")
    public boolean sendCrossChannel;

    @NoteField(value = "前缀类型")
    public int type;

    @NoteField(value = "随机系统文本权重")
    public double weight;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("id", -1);
        this.sendSystemChannel = xrw.getInteger("发送系统频道", 1) == 1;
        this.sendGuildChannel = xrw.getInteger("发送协会频道", 0) == 1;
        this.sendWorldChannel = xrw.getInteger("发送世界频道", 0) == 1;
        this.sendCrossChannel = xrw.getInteger("发送跨服频道", 0) == 1;
        this.type = xrw.getInteger("前缀类型",0);
        this.weight = xrw.getDouble("随机系统文本权重",0.0);
    }

    @Override
    public double getWeight() {
        return weight;
    }
}
